package com.zaicheng.cloud.loadbanlancer;

import com.zaicheng.cloud.loadbanlancer.rule.IRule;
import com.zaicheng.cloud.loadbanlancer.rule.impl.BaseRoudRule;
import com.zaicheng.cloud.loadbanlancer.server.Server;

import java.util.List;

/**
 @author zaicheng
 @version 1.0
 @date 2022-04-19
 @email zzc15847256473@163.com
 */

public class RemoteCallClientLoadBanlancer implements ILoadBalancer{

    private  static  final IRule DEFAULT_RULE = new BaseRoudRule();

    private  IRule rule;

    public RemoteCallClientLoadBanlancer() {
        this.rule = DEFAULT_RULE;
        this.setRule(DEFAULT_RULE);
    }

    public RemoteCallClientLoadBanlancer(IRule rule) {
        this.rule = rule;
    }

    @Override
    public void addServers(List<Server> var1) {

    }

    @Override
    public Server chooseServer(Object var1) {

        return null;
    }

    @Override
    public List<Server> getReachableServers() {
        return null;
    }

    @Override
    public List<Server> getAllServers() {
        return null;
    }

    public IRule getRule() {
        return rule;
    }

    public void setRule(IRule rule) {
        if (rule != null){
            this.rule = rule;
        }else {
            this.rule = new BaseRoudRule();
        }
        if (this.rule.getLoadBalancer() != this){
            this.getRule().setLoadBalancer(this);
        }
    }

    public  static  enum  ServerGroup{

        ALL,
        STATUS_UP,
        STATUS_NOT_UP;

        private ServerGroup(){
        }
    }

}
